package com.cloudlead.dictionaryAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.ObjectMap;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.dictionaryAction.BusinessModules;
import com.cloudlead.dictionaryAction.service.TbDictionaryEditSer;
import com.cloudlead.dictionaryService.TbDictionaryEditService;
import com.cloudlead.dictionaryService.vo.TbDictionaryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * Created by wyj on 2015/8/18.
 */
@Controller
public class TbDictionaryEditActionFactory extends AbstractActionFactory implements TbDictionaryEditService {

    @Autowired
    TbDictionaryEditSer tbDictionaryEditSer;
    public TbDictionaryEditActionFactory() {
        super(BusinessModules.DictionaryEdit);
    }

    @Action
    @Order(1)
    @Label("单值查询")
    public ObjectMap findOneDictionary(@NotNull @Label("查询条件") TbDictionaryVo vo) {
        return new ObjectMap(tbDictionaryEditSer.findOneDictionary(vo),"code,name");
  //      return tbDictionaryEditSer.findOneDictionary(vo);
    }

    @Action
    @Order(2)
    @Label("多值查询")
    public List<TbDictionaryVo> findAllDictionary(@NotNull @Label("查询条件") TbDictionaryVo vo) {
        return tbDictionaryEditSer.findAllDictionary(vo);
    }
}
